﻿<UserControl x:Class="Workbench.Presentation.POSTaggerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:vm="clr-namespace:Workbench.Presentation"
             xmlns:uc="clr-namespace:Workbench.Presentation.UserContols"
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="800">
    <UserControl.Resources>
        <vm:EnumToBoolConverter x:Key="enumConverter" />
    </UserControl.Resources>
    <DockPanel Margin="5">
        <StackPanel Orientation="Vertical"  DockPanel.Dock="Top">
            <uc:FileSelectView DataContext="{Binding FileSelectViewModel}"></uc:FileSelectView>
            <GroupBox IsEnabled="{Binding HasSelectedFile}" Header="Sentence">
                <uc:SentenceView DataContext="{Binding SentenceViewModel}"></uc:SentenceView>
            </GroupBox>
        </StackPanel>
        <Grid IsEnabled="{Binding HasSelectedFile}" DockPanel.Dock="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="150"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <GroupBox Margin="5" Padding="5" Grid.Column="0" Grid.Row="0"  Header="Word form">
                <uc:ProcessWordsListView DataContext="{Binding WordsListViewModel}"></uc:ProcessWordsListView>
            </GroupBox>
            <StackPanel Margin="10" Grid.Column="1" Grid.Row="0" Orientation="Vertical">
                <Button Margin="10 30 10 0" Command="{Binding SetPOSTypeCommand}">Set</Button>
                <Button Margin="10 15 10 20" Command="{Binding UnSetPOSTypeCommand}">Clear Set</Button>
                <GroupBox Padding="5" Header="Operation context">
                    <StackPanel >
                        <RadioButton Margin="0 5 0 0" GroupName="OpContext" IsChecked="{Binding Path=OperationContext, 
                                                    Converter={StaticResource enumConverter},
                                                    ConverterParameter=Selection}" Content="Selection"></RadioButton>
                        <RadioButton Margin="0 5 0 0" GroupName="OpContext" IsChecked="{Binding Path=OperationContext, 
                                                    Converter={StaticResource enumConverter}, 
                                                    ConverterParameter=CurrentFile}" Content="Current File"></RadioButton>
                        <RadioButton Margin="0 5 0 0" GroupName="OpContext" IsChecked="{Binding Path=OperationContext, 
                                                    Converter={StaticResource enumConverter}, 
                                                    ConverterParameter=AllFiles}" Content="All files"></RadioButton>
                    </StackPanel>
                </GroupBox>
            </StackPanel>
            <DockPanel Grid.Column="3">
                <DockPanel.Resources>
                    <Style TargetType="Button">
                        <Setter Property="Margin" Value="10 5"></Setter>
                    </Style>
                    <Style TargetType="TextBox">
                        <Setter Property="Margin" Value="10 5"></Setter>
                    </Style>
                    <vm:LevelToMarginConverterClass x:Key="levelToMargin"></vm:LevelToMarginConverterClass>
                </DockPanel.Resources>
                <GroupBox Margin="5" DockPanel.Dock="Top"  Header="Base Form">
                    <TextBox IsReadOnly="True" Margin="5" Text="{Binding CurrentBaseForm}"></TextBox>
                </GroupBox>
                <TextBlock Margin="15 15 15 0" DockPanel.Dock="Top" >POS Type</TextBlock>
                <ComboBox Margin="10 5"  DockPanel.Dock="Top" ItemsSource="{Binding POSTypes}" SelectedItem="{Binding SelectedPOSType}">
                    <ComboBox.ItemContainerStyle>
                        <Style TargetType="{x:Type ComboBoxItem}">
                            <Setter Property="IsEnabled" Value="{Binding IsEnabled}"/>
                        </Style>
                    </ComboBox.ItemContainerStyle>
                    <ComboBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock IsEnabled="{Binding IsEnabled}"
                                       Text="{Binding Name}" 
                                       Margin="{Binding Path=Level, 
                                                Converter={StaticResource levelToMargin}}" />
                        </DataTemplate>
                    </ComboBox.ItemTemplate>
                </ComboBox>
                <TextBlock Margin="15 15 15 0" DockPanel.Dock="Top" >Assigned Types</TextBlock>
                <ListBox 
                        ItemsSource="{Binding AssignedPOSTypes}" 
                         DockPanel.Dock="Top"
                        SelectedValue="{Binding SelectedAssignedPOSType}"
                        Margin="10 5 10 55">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <TextBlock IsEnabled="False" Text="{Binding Name}"  />
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </DockPanel>
        </Grid>
    </DockPanel>
</UserControl>
